package apiTest.common;

import apiTest.entity.AddressDetail;
import apiTest.entity.Student;
import apiTest.entity.Address;
import com.github.cyf.common.util.JacksonUtil;
import java.util.ArrayList;

/**
 * @author chenyifan
 * @create 2024-08-13 14:25
 */
public class DataUtil {

    public static Student getStudent() {
        AddressDetail addressDetail = new AddressDetail();
        addressDetail.setDetail("详细地址");
        Address address = new Address();
        address.setProvince("陕西省");
        address.setCity("渭南市");
        address.setCountry("富平县");
        address.setAddressDetail(addressDetail);
        ArrayList<String> list = new ArrayList<>();
        list.add("语文");
        list.add("数学");
        Student student = new Student();
        student.setId(1L);
        student.setName("zhangsan");
        student.setAge(20);
        student.setInterest(new String[]{"music", "coding"});
        student.setSubjects(list);
        student.setAddress(address);
        return student;
    }

    public static String getStudentJson() {
        return JacksonUtil.toJsonString(getStudent());
    }
}
